@use 'sass:map';
@use 'sass:color';
@use '@angular/material' as mat;
@use 'libs/component-angular/styles/material/all-components' as components;
@use 'libs/formly/formly-theme' as formly;
@use 'libs/story-angular/responsive/responsive-theme' as responsive;
@use 'libs/story-angular/story/story-theme' as story;
@use 'libs/story-angular/src/lib/story-theme' as story-designer;
@use 'libs/story-angular/widgets/widgets-theme' as widgets;
@use 'packages/angular/theming' as ocap;
@use './dark.theme' as dark-theme;

// Define a theme.
$primary: mat.define-palette(mat.$green-palette, 600);
$accent: mat.define-palette(mat.$amber-palette, A700, A400, A200);

$dark-theme: map.deep-merge(
  mat.define-dark-theme((
    color: (
      primary: $primary,
      accent: $accent,
    )
  )),
  (
    color: (
      background: dark-theme.$background,
      foreground: dark-theme.$foreground
    )
  )
);

$config: mat.get-color-config($dark-theme);
$foreground: map.get($config, foreground);

.dark.dark-green {
  --ngm-color-primary: #{mat.get-color-from-palette($primary)};
  --ngm-color-on-primary-container: #{darken(mat.get-color-from-palette($primary), 30%)};
  --ngm-color-primary-container: #{lighten(mat.get-color-from-palette($primary), 30%)};
  --ngm-color-primary-container-variant: #{color.change(mat.get-color-from-palette($primary), $alpha: 0.1)};
  --ngm-color-secondary: #{mat.get-color-from-palette($accent)};
  --ngm-color-secondary-container: #{lighten(mat.get-color-from-palette($accent), 30%)};
  --ngm-color-outline: #{map.get($foreground, divider)};

  // Include all theme styles for the mat components.
  @include mat.all-component-colors($dark-theme);
  @include components.all-component-colors($dark-theme);
  @include formly.color($dark-theme);
  @include responsive.color($dark-theme);
  @include story.color($dark-theme);
  @include story-designer.color($dark-theme);
  @include widgets.color($dark-theme);

  @include ocap.core-color($dark-theme);
  @include ocap.analytical-grid-color($dark-theme);
  @include ocap.breadcrumb-color($dark-theme);
  @include ocap.controls-color($dark-theme);
  @include ocap.entity-color($dark-theme);
  @include ocap.common-color($dark-theme);
}
